package com.server.service.impl;


import com.pojo.entity.Article;
import com.server.mapper.ArticleMapper;
import com.server.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public List<Article> GetArticleList() {
        return articleMapper.getArticleList();
    }

    @Override
    public Article GetArticleById(Integer id) {
        return articleMapper.findArticleById(id);
    }

    @Override
    public Integer insetArticle(Article article) {
        return articleMapper.insertArticle(article);
    }

    @Override
    public List<Article> selectArticleByTitle(String title) {

        return articleMapper.selectArticleByTitle("%"+title+"%");
    }

    @Override
    public List<Article> selectArticleByUserId(Integer userId) {
        return articleMapper.selectByUserId(userId);
    }

    @Override
    public Integer delById(Integer id) {
        return articleMapper.delById(id);
    }
}
